package app.beit.fintrack.service.convert;

import java.util.ArrayList;
import java.util.List;

import app.beit.fintrack.bean.HospitalBean;
import app.beit.fintrack.entity.Hospital;

public class HospitalConvert {

	/**
	 * Convert Entity To Bean
	 * 
	 * @param entity
	 * @return HospitalBean
	 */
	public static HospitalBean entityToBean(final Hospital entity) {
		final HospitalBean bean = new HospitalBean();

		bean.setHospitalCode(entity.getHospitalCode());
		bean.setHospitalName(entity.getHospitalName());

		return bean;
	}

	/**
	 * Convert Bean to Entity
	 * 
	 * @param bean
	 * @return Hospital
	 */
	public static Hospital beanToEntity(final HospitalBean bean){
		final Hospital entity = new Hospital();

		entity.setHospitalCode(bean.getHospitalCode());
		entity.setHospitalName(bean.getHospitalName());

		return entity;
	}

	/**
	 * Convert List Entity to List Bean
	 * 
	 * @param entities
	 * @return List HospitalBean
	 */
	public static List<HospitalBean> entityToBean(final List<Hospital> entities){
		final List<HospitalBean> beans = new ArrayList<HospitalBean>();

		for (final Hospital entity : entities) {
			beans.add(HospitalConvert.entityToBean(entity));
		}

		return beans;
	}

	/**
	 * Convert List Bean to List Entity
	 * 
	 * @param beans
	 * @return List Hospital
	 */
	public static List<Hospital> beanToEntity(final List<HospitalBean> beans){
		final List<Hospital> entities = new ArrayList<Hospital>();

		for (final HospitalBean bean : beans) {
			entities.add(HospitalConvert.beanToEntity(bean));
		}

		return entities;
	}

}
